This language bar is your friend. Select your favorite languages!
Select your favorite languages :
- Or search :
- Clojure
- C++
- C#
- C#
- Dart
- Elixir
- Fortran
- Go
- Haskell
- JS
- JS
- Java
- Java
- Java
- Lisp
- Lisp
- Lua
- PHP
- Pascal
- Perl
- Perl
- Python
- Ruby
- Ruby
- Ruby
- Rust
- Scheme
std::copy(a.begin(), a.end(), std::ostream_iterator<int>(std::cout, "\n"));
a can be any container that supplies iterators
The template parameter type on std::ostream_iterator should match the value_type on a.
Prints each element on a separate line; you can change the delimiter between elements by replacing "\n", BUT be warned: the delimiter will appear after the last element as well
The template parameter type on std::ostream_iterator should match the value_type on a.
Prints each element on a separate line; you can change the delimiter between elements by replacing "\n", BUT be warned: the delimiter will appear after the last element as well
fmt.Println(a)
a is a slice.
This works fine for simple types and structs.
It won't dereference pointers.
This works fine for simple types and structs.
It won't dereference pointers.
out.println(deepToString(a));
'... Returns a string representation of the "deep contents" of the specified array. If the array contains other arrays as elements, the string representation contains their contents and so on. This method is designed for converting multidimensional arrays to strings.'
(defun plist (lst)
(if (< (length lst) 20 )
(loop for elem in lst do (p elem))
(let ((l (length lst )))
(p (nth 0 lst )(nth 1 lst )(nth 2 lst )(nth 3 lst )
"... (" l " in total)... "
(nth (- l 4) lst )(nth (- l 3 ) lst )(nth (- l 2 ) lst )(nth (- l 1 ) lst ) )
)))
(defun p (x &rest others)
(cond ((listp x)( plist x ))
((stringp x)(format t x ))
(T (write x)))
(format t " ")
(if others (p others))
pretty-print a list, abbreviating the middle part if the list is too long.