How does a "case" anonymous function really work in Scala?
How does a "case" anonymous function really work in Scala?
Anonymous Functions in Scala | James Willett
Scala Anonymous Function - Testingpool
Scala: Passing a function literal as a function argument
Scala - Anonymous Functions - Tutorialspoint
Anonymous Functions | Scala 3 — Book | Scala Documentation
Anonymous functions in Scala - includehelp
Anonymous Functions in Scala - GeeksforGeeks
How to use function literals (anonymous functions) in Scala
Anonymous Functions | Scala Book | Scala Documentation
what is anonymous function in scala
what is anonymous function in scala - win
Proposal: Compound statement expressions, complex comprehensions, and assignment functions
I'd like to make the rather drastic proposal below on the python-ideas mailing list. To give it the best chance of success, I'm posting it here first for anyone willing to give feedback :) This is a proposal to allow certain multiline compound statements to be usable as expressions and to reform certain constructs such as lambda and list comprehensions. It's inspired by other modern languages where these ideas are common and the line between statement and expression is sometimes blurry, such as Ruby, Scala, and Kotlin. I know that similar (sometimes identical) ideas have been discussed to death before, so I apologise for bringing this up again. I have made note of some previous objections and have tried very hard to be thorough and think through all the possible consequences. Theoretically this could be broken down into at least 5 separate proposals, but there is a lot of overlap between them so I have chosen to present them all at once. If this is a problem, I'm happy to hear suggestions on how to separate the discussions.
Examples
Here are some simple examples of the proposed new syntaxes: Instead of:
if c1: z = foo(bar) x = y1 + z elif c2: x = y2 else: x = y3
one may write:
x = ( if c1: z = foo(bar) y1 + z elif c2: y2 else: y3 )
Instead of:
try: x = f() except ValueError: x = default1 except IndexError: x = default2 foo(x)
def can be used as an expression which returns the function object.
The function name is now optional, so in this case we've omitted it.
:= instead of : means that the expression is automatically returned
Instead of:
def key(x): # complex logic return y sorted(lst, key=key)
one may write:
sorted(lst, key= def key(t):= # complex logic y )
This is pretty similar to the last example. Key points:
I felt like putting a name there this time, because I can
Multiple statements are allowed in the function body.
:= automatically returns the last statement which must be an expression.
Instead of:
[ f(x) for y in z for x in y if g(x) ]
one may write:
[ for y in z: for x in y: if g(x): f(x) ]
Instead of:
lst = [] for x in y: if cond(x): break z = f(x) lst.append(z * 2)
one may write:
lst = [ for x in y: if cond(x): break z = f(x) yield z * 2 ]
Instead of:
[ {k: v for k, v in foo} for foo in bar ]
one may write:
[ for foo in bar: {for k, v in foo: k: v} ]
Specification
New expressions from compound statements
The value of a list of statements (a body) is the value of the last statement, or no value if the last statement is not an expression. This is determined at compile time. The value of an if/elif/else or a try/except/else is the value of the body of the last clause that executes. If the body of one of the clauses has no value, the compound statement containing the clause cannot be used as an expression, and attempting to do so is a SyntaxError, even if some other clauses have values. An if[/elif] with no else doesn't have a value. A try with a finally doesn't have a value. A function definition (def) is an expression which evaluates to the function object. The function name is optional. Parentheses around parameters are still required, particularly because otherwise def foo: could mean either def foo(): or def (foo): (an anonymous function with one parameter foo). An if, try, or def used as an expression shall here be called a compound statement expression, or CSE for short.
Whitespace
If all bodies of a CSE consist of just one expression, then we call this an inline CSE, because it can be inserted in the same line(s) as other code and there are fewer concerns about whitespace and disambiguation. The beginning of the CSE is clearly marked by a keyword, while the end would be determined by the same logic which determines the end of the current conditional expressions x if C else y or the body of a lambda. If the body of an inline CSE is also a CSE, the inner CSE must also be an inline CSE. Put differently, all our current expressions are inline expressions, and a CSE is also an inline expression if all of its bodies are inline expressions. Perhaps we should require that inner inline CSEs must have parentheses, e.g:
foo = if C: (if D: x else: y) else: z
If at least one body of a CSE has multiple statements or contains a non-expression statement, then it is not inline. The CSE must start and end with a newline, i.e. the lines containing the CSE cannot contain any tokens from outside. For example, this is allowed:
foo = bar( if C: x else: y )
but this is not:
foo = bar(if C: x else: y)
This means that if you wanted to add more arguments after in a function or a list literal, the comma must be on the next line. Since this looks weird:
foo = bar( if C: x else: y , spam, )
one might instead format it as:
foo = bar( ( if C: x else: y ), spam, )
which is also a bit clunky but I think that's OK because it's a gentle deterrent from abusing this syntax and putting too much information in one expression. This restriction ensures that it's easy to copy paste entire lines to move them around, whereas refactoring the invalid example above without specific tools would be annoying and error-prone. It also makes it easy to adjust code outside the CSE (e.g. rename foo to something longer) without messing up indentation and alignment. The first line after the end of a non-inline CSE must be less indented than the bodies of the CSE. For example, this:
x = \ if y: 1 else: 2 + 3
is the same as
x = ( if y: 1 else: 2 ) + 3
whereas
x = \ if y: 1 else: 2 + 3
means that the else has two statements 2 and + 3. These rules should help keep code readable at a glance and resolve questions about how statements embedded in expressions are disambiguated, for both humans and parsers. Inside a non-inline CSE, the rules for indentation and such are the same as anywhere else. The syntax of the CSE is valid if and only if it's also valid as a normal statement outside any expression.
Assignment functions
An assignment function is a function which starts with := instead of : and which automatically returns the value of its body, unless it encounters an explict return earlier on. If the body has no value, it's a syntax error. Implicit returns like this are quite popular in other modern programming languages. I've seen someone forgetting to return from a function as they were still adjusting to Python after years of Ruby. In this case I've copied the name and semantics from Coconut, a language which extends Python with functional programming syntax. The := could instead be ->, =>, ::, etc. Coconut just uses =. The point is just to distinguish from regular functions so that existing functions don't start returning new values. Note that def as an expression is a distinct concept from assignment functions. It's the combination of them that makes for a decent alternative to lambda, but you could also just use a def with an explicit return.
New style of comprehensions
A list/set/dict comprehension or generator expression is written as the appropriate brackets containing any number of statements including at least one for or while loop. In the general case the body looks like a generator function, and the elements (e.g. of the list) are the yielded values. If the comprehension contains exactly one expression statement at any level of nesting, i.e. if there is only one place where a yield can be placed at the start of a statement, then yield is not required and the expression is implicitly yielded. In particular this means that any existing comprehension translated into the new style doesn't require yield. If the comprehension doesn't contain exactly one expression statement and doesn't contain a yield, it's a SyntaxError. For dictionary comprehensions, a key: value pair is allowed as its own pseudo-statement or in a yield. It's not a real expression. If needed, maybe we'll require surrounding the pair in parentheses or just use a 2-tuple instead. New style comprehensions follow the same rules as CSEs regarding whitespace. Since a loop on its own is not an expression, comprehensions with nested loops must be spread across multiple lines.
Benefits/comparison to current methods
Uniform syntax
This replaces existing syntactical constructs that were each somewhat ad-hoc solutions with expressions that mimic existing syntax:
The conditional expression x if C else y is replaced with the if statement as an expression.
lambda is replaced by def as an expression, with optional syntactic sugar:
leaving out the name
implicitly returning with :=
Comprehensions just look like normal loops in brackets, or generator functions.
pass could just be replaced by None. It has no real use right now except to signal intent - writing None as a statement on its own currently looks weird and potentially means a misunderstanding that a linter should flag. With the new syntax it would become sensible and commonplace, e.g. as the body of an except for a default value when there's an exception.
In general the lack of additional syntactic constructs should make it easier for beginners to learn the language. For example a lambda involves a new dedicated keyword, lack of parentheses, an implicit return, and the restriction to a single expression. A def expression can be cut and pasted verbatim. A particular concept that's easier to learn is comprehensions that contain multiple loops. Consider this comprehension over a nested list:
[ f(cell) for row in matrix for cell in row ]
It's easy for an experienced Python coder to write this, but for beginners it can easily be confusing. Yes there's a rule that they can learn, but putting it in reverse also seems logical, perhaps even more so:
[ f(cell) for cell in row for row in matrix ]
Now the comprehension is 'consistently backwards', it reads more like English, and the usage of cell is right next to its definition. But of course that order is wrong...unless we want a nested list comprehension that produces a new nested list:
[ [ f(cell) for cell in row ] for row in matrix ]
Again, it's not hard for an experienced coder to understand this, but for a beginner grappling with new concepts this is not great. Now consider how the same two comprehensions would be written in the new syntax:
[ for row in matrix: for cell in row: f(cell) ] [ for row in matrix: [ for cell in row: f(cell) ] ]
No restriction to a single expression
The current constructs can only contain one expression in their 'bodies'. This restriction makes it difficult to solve certain problems elegantly and creates an uncomfortable grey area where it's hard to decide between squeezing maybe a bit too much into an expression or doing things 'manually'. This can lead to analysis paralysis and disagreements between coders and reviewers. For example, which of the following is the best?
clean = [ line.strip() for line in lines if line.strip() ] stripped = [line.strip() for line in lines] clean = [line for line in stripped if line] clean = list(filter(None, map(str.strip, lines))) clean = [] for line in lines: line = line.strip() if line: clean.append(line) def clean_lines(): for line in lines: line = line.strip() if line: yield line clean = list(clean_lines())
You probably have a favourite, but it's very subjective and this kind of problem requires judgement depending on the situation. For example, I'd choose the first version in this case, but a different version if I had to worry about duplicating something more complex or expensive than .strip(). And again, there's an awkward sweet spot where it's hard to decide whether I care enough about the duplication. Even more annoying is when I've already written a list comprehension but a new requirement forces me to change it to, say, the .append version. It's a tedious refactoring and leaves me with a completely unhelpful git diff. What about assignment expressions? We could do this:
clean = [ stripped for line in lines if (stripped := line.strip()) ]
Like the nested loops, this is tricky to parse without experience. The execution order can be confusing and the variable is used away from where it's defined. Even if you like it, there can be no doubt that it's controversial. I think the fact that assignment expressions were a desired feature despite being so controversial is a symptom of this problem. It's the kind of thing that happens when we're stuck with the limitations of a single expression. The solution with the new syntax is:
clean = [ for line in lines: stripped = line.strip() if stripped: stripped ]
or if you'd like to use an assignment expression:
clean = [ for line in lines: if stripped := line.strip(): stripped ]
I think both of these look great and are easily better than any of the other options. And I think it would be the clear winner in any similar situation - no careful judgement needed. This would become the one (and only one) obvious way to do it. The new syntax has the elegance of list comprehensions and the flexibility of multiple statements. It's completely scalable and works equally well from the simplest comprehension to big complicated constructions. I can easily add logic as I please and get a nice simple diff.
Support in previous PEPs
The syntax if C: x else: y was AFAICT the generally preferred syntax for conditional expressions in PEP 308 before Guido chose the current syntax instead. PEP 463 -- Exception-catching expressions proposed allowing expressions like:
value = (lst[2] except IndexError: "No value")
This was rejected, but clearly there was some demand and I think it would have been a nice feature. Perhaps try could be made similarly optional in simple inline expressions.
Compatibility
I believe this proposal has the following properties:
Implementing it (without dropping any existing syntax) would have no effect on the behaviour of existing code.
All of the new syntaxes and all existing syntax can happily live side by side.
There is exactly one obvious way to migrate any existing lambdas, conditional expressions, and comprehensions into the new syntax. Therefore this could easily be done by an automated tool and the new code would look sensible, albeit maybe in need of some formatting.
Java vs Kotlin: know which one is better to choose
Java Assignment Help experts will explain to you Java vs Kotlin in a better way. If you are a mobile app developer, Java is probably your language for building Android apps. But new languages are popping up everywhere that might challenge Java’s dominance in the Android world. One of them is Kotlin, a relatively new programming language, already announced by Google as a “first-class” language supported on Android. Although it is continually meaning evolved and enhanced, Kotlin is now viewing a mature ecosystem and its demand is growing quickly, especially on the mobile development scene. Now, you will better understand about Java Vs Kotlin.
In Java vs Kotlin experts will explain Java to Kotlin story
Kotlin v1.0 was published only on 15, February 2016, the history of this programming language defines back to 2011. JetBrains founded Kotlin for their practical needs. The company had 70% of its outputs build on Java but began to understand its shortcomings – mainly unnecessary wordiness. They wanted a programming language that would be Java-compatible since rewriting everything into a new programming language appeared as a no-go option. Everybody started experimenting with Scala but were not fulfilled. That is when the concept of a new programming language, Kotlin, was born.
Java vs Kotlin
To know the differences between Java vs Kotlin, primarily, we determined to discuss a few about each language. We will begin with Java, and you will know its benefits, drawbacks and also what we can do with this language. Next, we will converse about Kotlin, so that this language assists, benefits, limitations and what we can build? Finally, it will be great to get the key variations and benefits of Java vs Kotlin.
What is Java?
Java is a programming language created by James Gosling. We can create any type of program, it also supports almost any type of machine. It’s also for mobile in Linux operating system, Windows and Android. Currently, Java has the most important and largest community in the world. In both the Internet and the computer field, this language is very important. Java can be used to do almost anything. It should be considered that Java is completely free and can be used by anyone in the world. In this way, Java is a safe, powerful and universal programming language.
What can we program?
If you are an unimaginable programmer, you can perform anything with Java. With the most helpful websites, applications for Android, and among other things. Second, if you are a novice on the subject of programming in Java, there is no difficulty because you can start with a simple hello world, and then become a programmer to change this world.
Pros of Java
Easy to learn and understand.
Works great for native as well as cross-platform apps.
Since Android is built on Java itself, there are a lot of Java libraries to help you. Moreover, Java has a wide open-source ecosystem.
Java apps are even lighter and more compact than The Kotlin Apps, resulting in a faster app experience.
Java also provides a faster manufacturing process with more code in a short time.
Thanks to proceeding assembly with Gradle, collecting large projects becomes easier in Java.
Cons of Java
Java is a kind of heavy language, which means you write too much code, which increases the errors and bugs.
Java experiences some problems with Android API design due to inherent limitations.
Java requires more memory than other languages and therefore slows down.
Future Scope in Java
As a career for Java developers/programmers, anyone can consider the following job roles.
Web developer
Application developer
EJB programmer
Software developer
Tester
Graphic designer
A professional teacher in Java
What is Kotlin?
Kotlin is a new programming language of JetBrains. It first surfaced in 2011. “Kotlin” named his project was unveiled. Kotlin is an open-source language. Basically like Java, C, and C++ – Kotlin too. But it is different from Java. Here our experts will help you to tell about Java vs Kotlin. “Statically Typed Programming Languages” (is. Legally typed programming languages are languages that do not need to be defined before using variables. This means that static typing has to be done with a clear declaration or initialization of variables before they are planned. Java was earlier said to be an example of a statically typed language, similarly, C and C++ are also statically typed languages. Static typing does not mean that we have to use all the variables before declaring them. Variables in the program can be initialized anywhere and we (developers) need to do so anywhere in the program to use those variables.
Consider the following example of Java vs Kotlin
/* Java Code */ static int num1, num2; //explicit declaration num1 = 10; //use the variables anywhere num2 = 20; /* Kotlin Code*/ val a: Int val b: Int a = 10 b = 20 In addition to the classes and methods of object-oriented programming, Kotlin also supports procedural programming with the use of functions. Like Java, C and C++, the entry point of the Kotlin program “The main A function named “. Basically, it passed an array containing any command-line logic.
Consider the following example of Java vs Kotlin
/* Kotlin Programming*/ /* Hello Word Example*/ package hello //optional package header fun main(args: Array < String > ) { //The function package level, which returns the unit and takes an array of strings as parameters val scope = “world” println(“Hello, $scope!”) //Semicolons are optional, have you seen } Filename extensions of the Java are .java, .class, .jar but on the other hand filename extensions of the Kotlin are .kt and .kts.
What can we create?
With Kotlin we can make many things, whichever comes to mind. Some of the projects that are built-in Kotlin are Pinterest, Flipboard, Square, etc.
Pros of Kotlin
Kotlin is fast to write and, therefore, is very much liked by developers. If it takes 50 lines of code in Java, it takes only 1-2 lines in Kotlin. This also means that there are many fewer errors and bugs.
Kotlin aids in building a clean API.
Thanks to Java bytecodes, you can use Java libraries and frameworks in Kotlin, thereby converting Kotlin from Java into a seam.
Kotlin needs a lot in his kind of system, something that was missing in Java. Android uses null to represent the absence of a value and Kotlin lets you use null, which reduces the pain point very low.
The Anko library available for Kotlin is very helpful for developers and has a very active and detailed collection of projects on Github.
Cons of Kotlin
There is definitely a learning curve with Kotlin. It is a very short syntax, while a great benefit, requires some learning.
Kotlin shows a slower compilation speed than Java in most cases, even if it defeats Java in some instances.
The Kotlin community is still young and learning resources are limited, so finding answers to problems can be a bit difficult. However, with its growing popularity, resources and community will expand in time.
Since Kotlin is still new, finding experienced developers who can act as mentors for your team can be a bit difficult. Everyone is still learning and experiencing it.
Some features of Android Studio such as auto-completion and compliance run slower in Kotlin than java.
Difference Between Java vs Kotlin
Null Safety
As mentioned earlier, Kotlin avoids NullPointerException. Whenever NullPointerException can be thrown, Kotlin fails at compile-time.
Data Classes
Kotlin consists of boilerplate data classes, hashcodes, tostring, getters/setters and much more such as boilerplates lead to autogeneration.
Consider the following example of Java vs Kotlin
/* Java programming */ class Book { private String title; private Author author; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Author getAuthor() { return author; } public void setAuthor(Author author) { this.author = author; } } But the above one class in Kotlin may be briefly defined in a row /* kotlin programming */ data class Book(var title: String, var author: Author) It will also allow us to easily make copies of data classes with the help of copy() val book = Book(“Kotlin”, “JetBrains”) val copy = book.copy()
Extension Functions
Kotlin allows us to expand the functionality of existing classes without having inherited from them. That is to say, Kotlin provides the ability to extend a class with new functionality without inheriting from the class. This is done by expansion works. To declare an extension function, we have to prefix its name with a receiver type, that is. The type is being increased. The following adds a swap function to MutableList – fun MutableList < Int > .swap(index1: Int, index2: Int) { val tmp = this[index1] this[index1] = this[index2] this[index2] = tmp } The ‘this’ keyword inside the extension function belongs to the receiver object, which is passed before the dot. Now we can call such a function on any MutableList – val abc = mutableListOf(1, 2, 3) abc.swap(0, 2)
Smart Casts
When it comes to casts, the Kotlin compiler is intelligent. In many cases, one does not need to use the cast operators of clear in Kotlin, but for irreversible values in Kotlin and inserts casts become required automatically fun demo(x: Any) { if (x is String) { print(x.length) // x is automatically cast to string } }
Type Inference
In Kotlin, a great thing is that you don’t need to explicitly specify the type of each variable (clearly and in a detailed manner). But if you want to explicitly define the data type, you can do the same.
Consider the following example of Java vs Kotlin
/* not explicitly defined */ fun main(args: Array < String > ) { val text = 10 println(text) } /* explicitly defined */ fun main(args: Array < String > ) { val text: Int = 10 println(text) }
Functional Programming
The main important thing is that Kotlin is a functional programming language. Originally Kotlin includes several useful methods, including high-order tasks, long-rate expressions, operator overloading, lazy valuations, operator overloading and much more. Functional programming makes Kotlin much more useful when it comes to collections– fun main(args: Array < String > ) { val numbers = arrayListOf(15, -5, 11, -39) val nonNegativeNumbers = numbers.filter { it >= 0 } println(nonNegativeNumbers) } Output – 15, 11 High – Command tasks are functions that act as a parameter and also return a function.
Consider the following code of Java vs Kotlin
fun alphaNum (func: () -> unit){} In the code above, The name of the parameter “func” is the name of the parameter and the name of the parameter is “() -> Unit the function type. In this case, we are saying that func will be a function that does not achieve any parameters as well as does not return any value. Lambda expression or an anonymous function is a “Literal function, that is, a function that is not declared, but passed as an expression. val sum: (Int, Int) – > Int = { x, y – > x + y } In the above example, we declare only the variable ‘total’ that takes two integers and adds them together and returns as an integer. Then we use ‘sum(2,2)’ to call it. An anonymous function is a function that allows us to specify the return type and the function name is omitted in it.
Consider the following example of Java vs Kotlin
Either this way – fun(x: Int, y: Int): Int = x + y or This Way fun(x: Int, y: int): Int { return a + b }
Groestlcoin's Electrifying December 2019 Releases & Development Update
Groestlcoin brings the Lightning Network to the masses
https://www.youtube.com/watch?v=lFOvBhlAyJw&feature=share Groestlcoin has been on an emotional journey spanning 5 and a half years now and since being the first cryptocurrency to successfully activate SegWit, the developers have been hard at work bringing as much choice as possible to the options provided for utilising SegWit. Today brings another chapter to this story as every mainstream implementation of the Lightning Network has been ported to Groestlcoin. Groestlcoin has not been focused on a single implementation but instead has ported Éclair, LND, and C-Lightning to bring the users the greatest choice. Although extremely promising, the lightning network is still highly experimental so as a result, all channels are currently limited to 0.16 GRS per channel. The limit will be removed in the future once the system is proven stable enough. Additionally, there are also test-net versions of all implementations. Currently, Eclair is currently the most user-friendly so it will likely reach the most adoption among Groestlcoin users with LND and c-lightning being for more advanced users. We are now announcing the greatest release we have ever done in terms of technological advancements and the sheer quantity of released technologies.
Groestlcoin Eclair
Groestlcoin Eclair is a Scala implementation of the Lightning Network. It can run with or without a GUI and includes a JSON API.
Requirements
Requires Groestlcoin 2.17.1 or greater. If you are upgrading an existing wallet, you need to create a new address and send all your funds to that address.
Will use any GRS it finds in the Groestlcoin Core wallet to fund any channels you choose to open. Éclair will return GRS from closed channels to this wallet.
You can configure your Groestlcoin node to use either p2sh-segwit addresses or bech32 addresses since Eclair is compatible with both.
Features
Ability to create Lightning Network channels
Ability to close Lightning Network Channels
Completely manage all channel states, including exceptional ones!
C-Lightning is a specification-compliant Lightning Network implementation built in C. It is a lightweight, highly customisable and standard compliant implementation of the Lightning Network protocol. C-Lightning only works on Linux and Mac OS and requires a local or remote instance of Groestlcoind (version 2.16 or above) that is fully synced to the correct blockchain.
Features
Ability to create new channels
Ability to close existing channels
Completely manage all channel states, including exceptional ones
Performing path-finding within the network, passively forwarding incoming payments
Sending outgoing onion-encrypted payments through the network
The Lightning Network Daemon (LND) is a complete implementation of a Lightning Network Node. LND has several pluggable back-end chain services including GRSD (A full-node), groestlcoind, and neutrino (a new experimental light client). The project's codebase uses the GRSSuite set of Groestlcoin libraries and exports a large set of isolated re-usable Lightning Network related libraries within it.
Features
Ability to create new channels
Ability to close existing channels
Completely management all channel states, including exceptional ones
Maintains a fully authenticated and validated channel graph
Performs pathfinding within the network, passively forwarding incoming payments
Sending outgoing onion-encrypted payments through the network
Updating advertised fee schedules
Automatic channel management (autopilot)
Two primary RPC Interfaces are exported: A HTTP REST API, and a gRPC service
Groestlcoin Lightning Network Explorer – Mainnet & Testnet
Groestlcoin Lightning Network Explorer is a simple lightning network explorer that uses LND or C-Lightning as a source of the network graph. You can now look up how many LN nodes and channels there are on GRS Mainnet or Testnet.
Requirements
If connecting to a remote LND, you need to set lndHost and lndDir parameters
For C-Lightning you must set –daemon clightning and specify a clightningDir if you're not using the default location
Note that C-Lightning supplies fewer data about channels than LND.
Features
Light and Dark theme modes
Ability to create invoices and donate to the development funds
Open Source
View how many lightning network nodes and channels there are on the network
Groestlcoin Lightning Wallet (GLW) for Android – Mainnet & Testnet
The Groestlcoin Lightning Wallet features a standalone SPV Groestlcoin wallet with a fully functional built-in Lightning node. It allows users to send and receive regular on-chain transactions as well as off-chain Lightning Payments.
Features
Uses 'Olympus' servers which serve multiple functions, including storing an encrypted backup, functioning as a watchtower, and helps with the routing of payments across the Lightning Network
Supports TOR
Off-chain data-loss protection – in case of emergencies such as phone loss, you will only need a mnemonic phrase to recover both on-chain Groestlcoin balances and off-chain Lightning balances
Back-channel states on Google Drive and Olympus servers
Storage Tokens – These are special cryptographic entities provided by the Olympus server in exchange for a Lightning payment. You can think of these as a single-use ticket which can be used to anonymously store data such as lightning channel backups or watch-recovered channel states on the Olympus server
Watchtower service is present: don't worry about getting online periodically
Fingerprint support
Ability to use a trusted Groestlcoin node
Supports multiple fiat currency conversions
Includes a migration tool to move wallet data from one phone to another by making unencrypted snapshots
ZAP GRS is a free cross-platform Lightning-Network wallet focused on the user experience and ease-of-use. The overall goal of this wallet is to help the cryptocurrency community scale Groestlcoin. This wallet grants you the ability to trustlessly send and receive Groestlcoin instantly with minimal fees via the Lightning Network. Manage your private keys, multiple wallets and open channels to get connected with other peers on the Lightning Network and start transacting the future, today.
Features
Simple – The design philosophy of this wallet is rooted in the ability to consistently deliver the best user experience possible for a Groestlcoin wallet
Safe – Zap GRS is non-custodial. At no point does anyone else have access to your funds besides you, the user. Your keys, your coins, your node, your rules. All from your device.
Lightning-Fast – The Lightning Network offers a new way for users to interact with Groestlcoin. Transactions with ZAP-GRS are inexpensive and instantaneous, unlocking a new natively digital economy never seen before
ZAP-GRS is fully open source
Connect to your node – ZAP GRS lets users connect to their existing Lightning Node, allowing them to send, receive and manage their channels
Supports multiple wallets, allowing users to create and control as many wallets as they'd like. Remote nodes, GRSPay Server nodes, routing nodes, neutrino nodes, all in one place
Groestlcoin Spark is a minimalistic wallet GUI for c-lightning through desktop apps. Spark is currently orientated for technically advanced users and is not an all-in-one package, but rather a "remote control" interface for a c-lightning node that must be managed separately. Groestlcoin Spark is a purely off-chain wallet; allowing Groestlcoin to truly realise the power of lightning, that supports sending and receiving payments, viewing history, and managing channels.
Features
Channel Management – Click the "Channels" button inside the node info page to show and manage channels
Node Address – Click the node ID on the footer to open the 'node info' page which displays your node address (as text and QR code)
Pay & Request - one of the most intuitive features that demand to be seen and used
Display Unit - Supports multiple units as well as USD (gro, groestls, milli, GRS and USD)
Supports 16 different boot-swatch styles and themes, so you'll be sure to find one that best suits you
Payment Details – Click on payments in the list to show more details
Note that the fee shown includes C-Lightning's overpayment randomization
Expert Mode – Click the version number at the bottom-left to toggle expert mode. This will add two new menu items to show the Logs and an RPC Console. This will also display YAML dumps with additional information throughout the app
Zeus GRS is a mobile Groestlcoin app for Lightning Network Daemon (LND) node operators.
Requirements
You must be running a Lightning Network Daemon (LND)
You must provide Zeus GRS with your nodes hostname, port number and the LND macaroon you choose to use in HEX Format
If you're running a Unix-based operating system (i.e. Mac OS, Linux) you can run xxd -ps -u -c 1000 /path/to/admin.macaroon to generate your macaroon in hex-format
Features
Scan LNDConnect functionality
Connect to your node – Zeus GRS lets users connect to their existing Lightning node, allowing them to send, receive and manage their channels
Multiple Wallets – Zeus GRS allows users to create and control as many wallets as they require
GRSD is an alternative full-node Groestlcoin implementation written in Go (GOLang). If you want an alternative full-node wallet and are an advanced user, then GRSD is the right choice for you. The wallet will also properly relay newly mined blocks, maintains a transaction pool and relays individual transactions that have not yet made it into a block. It ensures all individual transactions admitted to the pool follow the rules required by the blockchain and also include more strict checks which filter transactions based on miner requirements ("standard" transactions).
Features
Works via TOR or SOCKS5 proxy
Can use a bootstrap.dat format as a blockchain database
Supports Websockets (GRSD/GRSWallet) and HTTP Post mode (Groestlcoin Core)
Provides callback and registration functions for GRSD/GRSWallet notifications
Supports GRSD extensions
Translates to and from higher-level and easier-to-use Go types
Offers a synchronous (blocking) and asynchronous API
Supports the getblocktemplate RPC
It comes with a separate GRSCTL command line utility (CLI) that can be used to both control and query GRSD via RPC. GRSD does not enable its RPC server by default; you must configure, at minimum, both an RPC username and password or both an RPC limited username and password
KWH-GRS Browser Extension (Google Chrome & Mozilla Firefox)
KWH-GRS is a companion browser extension for C-Lightning and Éclair nodes which connects to C-Lightning or Éclair nodes and enables interactions with Lightning apps.
Requirements
A C-Lightning node with a Spark in front of it
An Eclair node with an API enabled and accessible
Features
Browse balances and latest transactions
Supports WebLN
Context menu option to pay highlighted invoices
Handle lightning – Links
Context menu option to generate invoices
Manual payments and invoice creation
Instant notifications on received payments
No window popups, all interactions happen within the extension
GRSPay is a free, open-source, non-custodial cryptocurrency payment processor which allows you to receive payments in Groestlcoin with no fees, transaction cost or middlemen. GRSPay eliminates the involvement of a third-party. Payments with GRSPay go directly to your wallet, which increases privacy and security. Your private keys are never visible to the GRSPay Server or anyone else. There is no address re-use since each invoice generates a new address deriving from your public key. For more details, click here for the GRSPay launch details and FAQ.
I am creating a functional programming language with syntax similar to Haskell and I am considering adding syntactic sugar for helper functions. For example, a tail recursive implementation of factorial in Haskell might look something like this:
fact = go 1 where go acc 0 = acc go acc n = go (n * acc) (n - 1)
Having to create a new function with its own name each time you want to do something seems like a perfect place to me to use syntactic sugar. In my language, it might look like this:
fact = case 1 _ of acc 0 -> acc acc n -> rec (n * acc) (n - 1)
The idea is that an underscore represents a value to be filled in (similar to anonymous functions in Scala) and that the rec keyword is used for tail recursive calls. The case ... of is similar to Haskell except that it takes multiple values to pattern match against to allow for definitions like this. What do you think about this idea? Do you have a better syntax for it in your language? Edit: I've decided against the underscore syntax in favor of directly applying the initial accumulator value to the function literal using a pipe operator |> like in Elm:
Currently running 1.3.1, I can't uninstall any apps. It says "Unable to remove application". I don't get any prompt on the ledger to allow uninstall This is what I found in the log files:
2018-05-31T05:16:15.579Z D/Global: (last _firmwares,Some(Success([object Object]))) 2018-05-31T05:16:20.095Z D/Global: apps 2018-05-31T05:16:20.096Z D/Global: 9bb8d31ddf095384b2c991a46e2d3bf9372a4b7b27440b92c55031b319b090b2 2018-05-31T05:16:20.511Z D/Global: Received { 2018-05-31T05:16:20.513Z D/Global: "nonce": 1, 2018-05-31T05:16:20.515Z D/Global: "query": "exchange", 2018-05-31T05:16:20.516Z D/Global: "data": "e00400000431100002" 2018-05-31T05:16:20.518Z D/Global: } 2018-05-31T05:16:20.519Z D/Global: Query: exchange 2018-05-31T05:16:20.530Z V/APDU: => E00400000431100002 2018-05-31T05:16:20.535Z V/APDU: <= 9000 2018-05-31T05:16:51.788Z D/Global: Received { 2018-05-31T05:16:51.790Z D/Global: "query": "error", 2018-05-31T05:16:51.790Z D/Global: "data": "" 2018-05-31T05:16:51.791Z D/Global: } 2018-05-31T05:16:51.792Z D/Global: Query: error 2018-05-31T05:16:51.795Z E/Global: java.lang.Exception: 2018-05-31T05:16:51.796Z E/Global: at $c_jl_Exception.$c_jl_Throwable.fillInStackTrace__jl_Throwable(https://raw.githubusercontent.com/scala-js/scala-js/v0.6.9/library/src/main/scala/scala/scalajs/runtime/StackTrace.scala:33:4) 2018-05-31T05:16:52.077Z E/Global: at $c_jl_Exception.$c_jl_Throwable.init___T__jl_Throwable(https://raw.githubusercontent.com/scala-js/scala-js/v0.6.9/javalanglib/src/main/scala/java/lang/Throwables.scala:12:18) 2018-05-31T05:16:52.078Z E/Global: at java.lang.Exception.(https://raw.githubusercontent.com/scala-js/scala-js/v0.6.9/javalanglib/src/main/scala/java/lang/Throwables.scala:269:6) 2018-05-31T05:16:52.079Z E/Global: at {anonymous}()(../../src/main/scala/co/ledgemanageweb/controllers/manageold/OldApplyScriptController.scala:243:15) 2018-05-31T05:16:52.080Z E/Global: at scala.scalajs.runtime.AnonFunction1.apply(https://raw.githubusercontent.com/scala-js/scala-js/v0.6.9/library/src/main/scala/scala/scalajs/runtime/AnonFunctions.scala:15:37) 2018-05-31T05:16:52.081Z E/Global: at co.ledger.manager.web.core.net.JsWebSocketFactory$JsWebSocket$$anonfun$1.apply(../../src/main/scala/co/ledgemanageweb/core/net/JsWebSocketFactory.scala:69:28) 2018-05-31T05:16:52.081Z E/Global: at co.ledger.manager.web.core.net.JsWebSocketFactory$JsWebSocket$$anonfun$1.apply(../../src/main/scala/co/ledgemanageweb/core/net/JsWebSocketFactory.scala:67:46) 2018-05-31T05:16:52.082Z E/Global: at WebSocket.(../../src/main/scala/co/ledgemanageweb/core/net/JsWebSocketFactory.scala:67:46) 2018-05-31T05:26:54.768Z D/Global: (last _firmwares,Some(Success([object Object]))) 2018-05-31T05:26:59.998Z D/Global: apps 2018-05-31T05:26:59.998Z D/Global: 641b73915759276f5c529c0801aaacde190c4f963dc39b82aca16b5b96dff4db 2018-05-31T05:27:00.434Z D/Global: Received { 2018-05-31T05:27:00.435Z D/Global: "nonce": 1, 2018-05-31T05:27:00.435Z D/Global: "query": "exchange", 2018-05-31T05:27:00.436Z D/Global: "data": "e00400000431100002" 2018-05-31T05:27:00.437Z D/Global: } 2018-05-31T05:27:00.438Z D/Global: Query: exchange 2018-05-31T05:27:00.441Z V/APDU: => E00400000431100002 2018-05-31T05:27:00.444Z V/APDU: <= 9000 2018-05-31T05:27:00.651Z D/Global: Received { 2018-05-31T05:27:00.652Z D/Global: "query": "error", 2018-05-31T05:27:00.654Z D/Global: "data": "HTTP Error 502: Bad Gateway" 2018-05-31T05:27:00.655Z D/Global: } 2018-05-31T05:27:00.656Z D/Global: Query: error 2018-05-31T05:27:00.660Z E/Global: java.lang.Exception: HTTP Error 502: Bad Gateway 2018-05-31T05:27:00.661Z E/Global: at $c_jl_Exception.$c_jl_Throwable.fillInStackTrace__jl_Throwable(https://raw.githubusercontent.com/scala-js/scala-js/v0.6.9/library/src/main/scala/scala/scalajs/runtime/StackTrace.scala:33:4) 2018-05-31T05:27:00.663Z E/Global: at $c_jl_Exception.$c_jl_Throwable.init___T__jl_Throwable(https://raw.githubusercontent.com/scala-js/scala-js/v0.6.9/javalanglib/src/main/scala/java/lang/Throwables.scala:12:18) 2018-05-31T05:27:00.665Z E/Global: at java.lang.Exception.(https://raw.githubusercontent.com/scala-js/scala-js/v0.6.9/javalanglib/src/main/scala/java/lang/Throwables.scala:269:6) 2018-05-31T05:27:00.667Z E/Global: at {anonymous}()(../../src/main/scala/co/ledgemanageweb/controllers/manageold/OldApplyScriptController.scala:243:15) 2018-05-31T05:27:00.669Z E/Global: at scala.scalajs.runtime.AnonFunction1.apply(https://raw.githubusercontent.com/scala-js/scala-js/v0.6.9/library/src/main/scala/scala/scalajs/runtime/AnonFunctions.scala:15:37) 2018-05-31T05:27:00.670Z E/Global: at co.ledger.manager.web.core.net.JsWebSocketFactory$JsWebSocket$$anonfun$1.apply(../../src/main/scala/co/ledgemanageweb/core/net/JsWebSocketFactory.scala:69:28) 2018-05-31T05:27:00.672Z E/Global: at co.ledger.manager.web.core.net.JsWebSocketFactory$JsWebSocket$$anonfun$1.apply(../../src/main/scala/co/ledgemanageweb/core/net/JsWebSocketFactory.scala:67:46) 2018-05-31T05:27:00.674Z E/Global: at WebSocket.(../../src/main/scala/co/ledgemanageweb/core/net/JsWebSocketFactory.scala:67:46)
I've tried resetting it by entering incorrect pin 3 times and recovering using the 24 word phrase, but all of my installed apps are still there. I've also tried exiting Chrome completely and restarting my computer. No firewalls, no anti-virus, no VPN enabled
What is favorite fancy terse expressive elegant language and why?
Hi all! The title may be weird question, but I think it makes sense if I explain a bit further. Hope this doesn’t become a huge rant! But it will… I tend to group languages into two groups:
Straight-forward work-horse like languages, where you explicitly write down what you want and the language does it. A bit of WYSIWYG of programming languages.
Fancy expressive languages, where there is a lot more going on that simply writing down simple natural ideas in their most straight forward and verbose forms.
I don’t know if other people use this distinction and if the types have a better name than workhorse and fancy. These are stupid names. How do people call these language types? And of course, this is just a single way of grouping. You can have compiled and interpreted, and while traditionally more compiled languages are workhorse and more scripting languages are fancy, you can and do have fancy compiled languages and straightforward scripting languages. And of course practicality and elegance are again different variables and you can have many possible combinations. To better explain, let’s go though some examples. C for example is work-horse like. There is nothing fancy about the C syntax or features, even though it is probably far more complicated than its feature set would imply. But you sit down, tell it what to do in an imperative fashion. Almost the entirety of C can be summed up as calling functions. C++ is the same: it is even more complicated, and if you do not count template-metaprogramming and third party libraries, C++ and its standard library are not fancy. But I’ve seen some third party libraries that really try some fancy expressive things. C# the same, but LINQ is arguably and exception. In the domain of scripting, Python looks pretty workhorse. It probably the most “C of scripting languages” from the bunch. I have less experience with Perl, but it feels the same. You can use Ruby in a similar fashion, but Ruby is often described as having a bit of “magic” behind it. I’ve experienced it myself and described it as the “language reading my mind and doing what I want it without telling it to”. Of course, this is a major embellishment, but there is still truth to it. You need to gather a lot of familiarity with the language to program in that style, but I guess this is something that applies to all fancy languages. So a few questions:
Does my distinction between work-horse and fancy make any sense or is it just in my head.
If it makes sense, what fancy languages do you like to use and why
What fancy languages are there in use today.
Related to the last question, I would like to exclude older more-academic languages that you can’t really get a job in, languages you can list for question #2. I’m not looking for a job, only I’ve noticed that a lot of fancy languages are older and more academic, not really in widespread use in a practical way in 2017. Most of these fancy older languages pioneered some new concept in programming. And as an answer to the same question, I would say Ruby and Scala. And Scala, while I think it is very difficult to learn, is really up there on the fancy scale. I don’t think there is any other languages that are in use and modern that even come close. Or maybe I’m wrong… That concludes the main part of the question. The rest is the PS with the motivation for this question.
PS:
I started thinking about his related to the programming language I’m implementing: it was designed to be implemented in two phase. Phase 1 are the work-horse features, phase 2 the fancy stuff. It was decided that it is imperative to first set a rock solid feature set that would form a great foundation made out of only wok-horse like features. The idea was to create a language which if some very experienced developer picks up for the first time, he/she could start writing decent code in a couple of days and in couple of weeks could say that decent mastery over the entire language was achieved. Such a language is very straight forward, imperative and unambiguous. It can also be stuffy and verbose. This is where the super-expressive fancy stuff comes in, phase 2. Initially the design was based on several other languages, but Ruby had a big part in it. Now I’m thinking some of Scala like feature would be a better fit. So again, what fancy languages do you like and why? I’ll try to understand the reasoning and try to assess the “value” of these features.
PS2:
Implementing a fancy compiler is ridiculously hard. Our compiler is so not up to the task that it is almost funny. And our compiler does try to be a bit clever by design and it is still not enough, by a wide margin. Let me give a quick contrived example: let’s say you want to create a fixed length C array with two strings in it, strings obtained from converting objects to string, let’s say two integers.
val c = CArray[1.ToString(), 2.ToString()]
That is the same as saying:
val c = CArray[“1”, “2”]
A bit of a context: the [] syntax is an abstract collection of items which when not being forced to become a concrete type, will decay to the most straightforward dynamic vector. So [1, 2] is an abstract collection of the items 1 and 2, and it could be anything, but in practice, if you just go val a = [1, 2], “a” will be a mutable dynamic heap allocated vector of integers. Prefixing the [] syntax with Foo[] will override the decay to the class Foo which must be a container, so List[1, 2] will be a list and CArray will be a classic C array with fixed size and no length stored at runtime. With this decaying mechanism and the type inference, the compiler looks like a good fit for the fancy stuff. Or so I thought… Fancy often means functional, lambdas, tuples and more algebraic types, patterns and so on. And the compiler is not up for that. Yet! I started updating the specs from a more Ruby inspired design to a more Scala inspired design, and immediately rewrote that sample as:
val c: CArray = [1, 2].Apply(_.ToString())
This is really basic stuff, but there is a ton going on. [1, 2] is a vector of integers. You Apply in a functional style an anonymous lambda that goes though the elements and returns a new vector. Our programming language is natively compiled, statically typed and needs to be pretty much one of the fastest thing possible. So you can’t create a temporary [1, 2], apply ToString to each element and return a new vector with the results of the application in it. Which is then overridden to be a CArray by the val c: CArray syntax, so the whole vector was a CArray all the time, only it did not know it when it was created. And you can’t afford to execute the anonymous lambdas as function calls. Basically, the compiler needs to take:
val c: CArray = [1, 2].Apply(_.ToString())
And spit out
val c = CArray[1.ToString(), 2.ToString()]
Completely transparently to the user, with zero performance overhead. Basically the assembly for the two samples must be identical. And it needs to make sure to do proper copy elision, so if you do something like this in pseudocde:
%tmp1% = 1.ToString() %tmp2% = 2.ToString() val c = CArray[%tmp1%, %tmp2%] => Alloca c = CArray[2] => copy %tmp1% to c[0] => copy %tmp2% to c[1] => destroy %tmp1% => destroy %tmp2%
Then you are doing it all wrong! You need to do:
alloca c = CArray[2] 1.ToString(&c[0]) 2.ToString(&c[1])
In short, compiling this is both hell and a total blast!
I'm following the example found in the slides of Pascal Voitot's "20,000 Leagues Under the Sea" Scala IO talk. Specifically to this spec: link Using the examples of Log and Http, I created my own examples. They are a little long so I'll include the gists for Users.scala and package.scala I thought I should code for errors as well as success but I feel that my DSL is a little too verbose. Especially when I try to use them in a sample function, addUser. While I would normally use the DB to enforce login name uniqueness, I wanted to see what the code would work itself out to be if I first queried. However, since QueryForLogin and AddUser return a different disjunction than the addUser function, I need to transform them into Error and Success messages. It seems odd to include these in my DSL as I would need to define more ErroSuccess for different return types (ie: AllUsers). What would be the best way of defining this simple CRUD DSL? Should I just remove the error return types? If so how would you then code for possible errors?
Hi everyone, After going through a lot of reading materials I have collected, I have narrowed the topics that we can learn for the first week. For the people who are already halfway into learning scala, these may be redundant but you can help us by sharing things that we might have missed. Following the topics Day 1 - Introduction(I hate it too, but has to be done)
What is Scala
Why scala
Oops.add(functional)
Scala and JVM
Installation
REPL
Day 2 - Variables, Functions & Literals
var vs val
Function definition
Named parameters
Anonymous functions
Literals
Day 3 - List, Tuple & Array Day 4 - Control Structures
If
While
For
Foreach
Day 5 - Pattern Matching
A Simple Match
Matching on Type
Matching on Sequences
Matching on Tuples (and Guards)
Matching on Case Classes
Matching on Regular Expressions
Binding Nested Variables in Case Clauses
Day 6 - Class & Object
Constructors
Abstract Classes
Nested Classes
Objects and companion objects
Day 7 - Case Class If you think, I have not covered any topic, please let me know in the comments I'll add them here or will add them in the following weeks. Suggestions are most welcome.
A new scalac phase for sbt support ... the beginning of "a more perfect union"?
Looking at what's cooking (ie, branches that don't show up in the "commit velocity" stats)
@@ -700,6 +706,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) superAccessors -> "add super accessors in traits and nested classes", extensionMethods -> "add extension methods for inline classes", pickler -> "serialize symbol tables", + API -> "summarize symbol tables as API for sbt", refChecks -> "reference/override checking, translate nested objects", uncurry -> "uncurry, translate function values to anonymous classes", tailCalls -> "replace tail calls by jumps",
Is it possible to implement Scala PartialFunction in Kotlin?
Hi, I'm working on a little side project and need a 1:1 implementation of PartialFunction in Kotlin. I'm at this stage and get 2 errors from IntelliJ ...
Error:(4, 23) Kotlin: Type parameter B is declared as 'out' but occurs in 'in' position in type B
Error:(11, 29) Kotlin: Type mismatch: inferred type is B but B1 was expected
... and I don't know how to fix them. I need in A/out B because another type which uses PartialFunction also specifies its usage of B as out. EDIT: Do I need A1 and B1 at all or is in/out doing what A1 <: A and B1 >: B is doing in Scala? EDIT2: This seems to do what I wan't; anyone with enough Scala and Kotlin knowledge able say if it will do what the Scala code does?
I'm working on creating a demographics crowdsourcing system. Some rough edges, but would love feedback.
I've posted about this before, but since then, I've added a bunch of functionality. I'm working on a creating a platform called Statly ( http://www.statly.net ). It's meant to allow people to combine data from their various accounts online along with social polling to create a demographics dataset. The more services you connect the more questions you answer, the more dimensions are available in the download. Privacy
There is no directly identifying data available for download. We define 'directly identifying' as things like Name, Email Address, Twitter Handle, Reddit Account Name, or anything else specifically unique to the user.
While anonymity is our intent, there's no way for us to guarantee it. We are very aware of the Netflix controversy.
We have no interest or intention to create a business plan that would sell directly identifying data to anyone. If we were to EVER consider doing something like that, users would be offered to opportunity to opt-in, and would never have to opt-out.
Current Services
Facebook (Required to access system)
Twitter
Reddit
Question Types
Boolean Visualization of answers displayed a pie chart.
Free Form Text Visualization of answers not available yet. Suggestions encouraged.
Multiple Choice Visualization of answers not available yet. Suggestions encouraged.
Coming Soon
More clarity on how this works directly on the site.
The ability for users to submit questions.
Control over what columns are in the download, in what order, and what columns can't be null.
Control over what format the data is downloaded in (tab separated available now, XML and JSON coming, XLSX and Google Spreadsheet under consideration).
How long have we been at this? About 3 or 4 months. What motivated me to start this? I'm always looking for interesting demographics datasets, but I can never find them. I think that's silly since if we were to all combine our data, we'd have awesome stuff to mine. I also took inspiration from this dataset that I found about demographics by zip code on the NYC open data site. I basically wanted this exact data, but larger, and with any dimensions I wanted. What's your 6-month plan? Now that I've got at least an minimal viable product done to show it off, we'll likely look to get marketing and SEO start to get focused on. We'll also be going rampant adding connectors to additional services. What's your sign? Virgo Seriously? Facebook's the only way you can login? For now yes. We'll allow email address sign ups soon enough, but since we also wanted social media connectivity, we went in one direction at first, with the intention of giving people other ways to create an account in the future. Data Download is only in a big .txt? That's the next bit of functionality we're working on. You'll be able to to select what columns are included, in what order, which columns will allow nulls, and how the columns are sorted. You'll be able to choose JSON and XML as well as TXT. Wait...I can't make my own questions? That's dumb. We're getting there. The creation of questions is definitely something users will be able to do in the future, but at this stage, it's not our top priority quite yet. However, happy to hear feedback on that topic to change my mind. What's this written in? The back end is Scala and Elastic Search. The front end is all Twitter Bootstrap with FontAwesome and AngularJS. The visualizations are NVD3. Help me test this out! www.statly.net
Suzanne L. Marchand, German Orientalism in the Age of Empire: Religion, Race and Scholarship, Current scholars of art historiography are fortunate to have German Orientalism in the Age of Empire. Thirty years ago when I was at work on my dissertation on the Austrian art historian and theorist Alois Riegl, I was disappointed that Orientalism, Edward Said’s important book, purposely ignored exactly those scholars, Germans and Austrians, whose work I encountered as I traveled through nineteenth century academia. I hungered for the kind of guidebook that could help me think myself into their time, place them in a context, and impart something of their backgrounds and interests. Marchand deserves our gratitude for her explorations of countless official and personal archives, and for conveying her subject with the expansiveness of an author who has read widely and the intimacy of one who has read deeply. Said’s Orientalism lurks in the background of German Orientalism, and many of Marchand’s generalizations imply challenges to his assumptions. Yet Marchand rarely addresses his work directly. Instead of merely filling an important gap in his picture of Orientalism, she uses the example of German scholarship to complicate his ideological interpretation of Orientalism. By focusing on the interplay between intellectual, institutional and political history, she reveals the contradictions and opposing forces that informed orientalism and oriental scholarship. Furthermore, Marchand covers different territory from Said. The Orientalism she traces is not focused on the Middle East. Like the nineteenth century scholars she studies, she uses the term “Oriental” to cover East and South Asia as well. She presents a more multifaceted picture of Orientalism by extending it to its pre-Saidian borders, and thus complicates the field mainly for better, but occasionally, as we shall see, for worse. In ten chapters and an epilog, Marchand moves from the Enlightenment, when study of the “Orient” first became possible and even respectable, through the difficult middle decades of the nineteenth century in which “lonely orientalists,” struggled in anonymity and without proper academic positions, to a time, late in the century, when “furious orientalists” fought their way through the combination of sheer antagonism and sometimes audacious theories that challenged received wisdom about the indebtedness of Christianity to Judaism and other subjects. Along the way, she relates how academic positions are won and lost, as the rise and fall of empires nurtured some forms of Orientalist scholarship and discouraged others. She addresses key questions about Western cultural dependence on the East, the origins of Christianity, the status of sacred texts, the organization of disciplines, the establishment of chairs in Orientalistik, the beginning of Religionsgeschichte, the relation of Christianity to Buddhism and Zoroastrianism and many others. She examines the biographies of scholars from Johann Gottfried Herder and Friedrich Creuzer to Ignaz Goldziher and Josef Strzygowski in order to illuminate and problematize the relation between Orientalism and racism. The detailed, complex narrative repeatedly belies easy assumptions about the relationship of knowledge to power. Attempts to use Orientalism to support received religious ideas backfired, and imperial power, too, often failed to determine what scholars would find. Scholars, mere humans wrestling with language, often succumbed to the power of their own ideas. One of the unintended consequences of scholarship is that one can undermine the idea one tries to serve. In her many case studies, Marchand shows how those who tried to use Oriental studies to prove the truth of the scriptures found their own ideas changing instead. Although starting from a detached academic point of view, they often ended up seeing through the eyes of those they studied. Earlier scholars laid the foundation for the work of later scholars who would accuse them of Orientalism. In penetrating discussions of Herder and Johann Salomo Semler, she shows how their attempt to find truth in the “primitive” in fact historicized these cultures and their scriptures: “once [the scriptures are] put in historical and anthropological context, it was difficult to extract them”. Even if the scholars themselves were not changed by their studies, their texts were often used against their intentions, as probably happened, for example, to Johann David Michaelis. Her treatment of Richard Wilhelm and Erwin Baelz challenge received notions about the relation of Orientalists’ prejudices to the colonial function of scholarship. Even when scholars wished to be “relevant” to empire, imperialists were right to worry about their penchant to go native. But for much of the period covered in the book, there was no empire to call the scholarly shots by ensuring or preventing scholarly advancement. How could “lonely orientalists,” working in obscure fields against odds and with no prospect of employment, contribute to ideologies of power? In Chapter Nine, “Interpreting Oriental Art,” art historiography takes center stage. Some of the material is familiar terrain for readers of Marchand’s earlier Down from Olympus or her essay on Josef Strzygowski. Here her vista extends to issues of classification that determine whether a work is to be treated as art or artifact, and to such topics as oriental carpets and exhibitions. Her earlier interest in archaeology expands to include the fascinating and understudied Turfan expeditions to Central Asia. For an art historiographer, the book is especially useful insofar as it looks at art history in the context and from the vantage point of a wider scholarly world out of which it comes: philology, biblical scholarship, orientalist studies. It is useful to watch art historians embarking on the same trips as Oriental philologists and relying on the same conquests, particularly when their object was to build collections. It is instructive to consider comparisons between scholars of Oriental languages and art: whether a catalogue is equivalent to a dictionary, for example. Embedded as it is in a narrative centered on the study of “Oriental” religions and literatures, the visual element that differentiates the study of art history from these other areas does not come through powerfully or distinctly. I therefore hope that this book will inspire others to further work on scholars of visual arts and orientalism. If so, one area of interest is the way in which their work brought them into dialogue with other visual disciplines such as the physical anthropologists, scientists who relied on visual classifications and created portfolios of their drawings and photographs, as did architects, designers and art historians. In their work, culture and racial theory often intersected, thus clarifying the visual dimension of the relations between race and scholarly Orientalism. Scholarly arguments also clarified this relationship. While Strzygowski, as Marchand argues, indeed granted Jews a role in Western art, this was a malevolent role in the wider war of the races to which he ascribed the historical trajectory of western art. The people from the east whom Strzygowski wished to rehabilitate were Aryans. To this end, he attributed the Mshatta façade not to Islamic art, but to the “northern” spirit. When Strzygowski mentioned “Aryans” specifically, he generally meant Persians, a fact that got him in trouble not only with other Orientalists, but eventually with National Socialists as well. The Persians were important to him as the racial “origin” of the Aryans. Marchand’s searching discussion of pan-Babylonism and especially the Bibel-Babel controversy, which shows the stake that some Orientalists had in the significance of origins, here applies to art history. Art historians who thought that the discovery of the origin of a visual form was its key explanatory factor, often equated folk styles of various countries with early styles. Others, however, were wary of this move, and not merely because of a proto-Fabian realization of the equation of Otherness with distance in time. They valued origins lightly because they valued function more. In Altorientalische Teppiche, for example, Riegl attributed ornamental change to culture. There are the usual run of inevitable mistakes: Josef Strzygowski was not Alois Riegl’s student, but his contemporary and rival ). Riegl was a scholar and a curator, not a “connoisseur”; he did not curate a large exhibition of carpets in the Handelsmuseum (curated by Artur von Scala), but only wrote a catalog essay for it. Some information Marchand did not encounter would strengthen, add complexity to (and lengthen) her argument. She is mistaken when she writes that Riegl did not visit the “Orient.” His early work had been informed primarily by pattern books and other illustrations, but he soon changed his mind and traveled to Egypt, visiting Cairo and floating down the Nile to Luxor. He saw the ornaments of Ibn Talun and became convinced that only first hand views of the monuments would suffice for proper scholarly study. In 1901, he wrote impassionedly to his colleague Franz Wickhoff begging him, in connection with a planned publication on Qusayr Amra, to undertake an exhibition to Jordon to see the monument. Riegl tried to underplay the arduous journey, but Wickhoff must have been able to read the subtext and withdrew from the project in favor of Riegl, although in the end Riegl’s health prevented him from going. Marchand could use this anecdote to illustrate her point that accidents of circumstances are often catalysts for Oriental scholarship. It could also suggest the growing significance of the culture of observation whose history and theoretical consequences have been explored by Lorraine Daston and Peter Galison. This concern was vital to art history, and explains the significance for art historians of travel to monuments, although not always the collection of artifacts. Art historians most frequently brought back from these trips not artifacts, but rather photographs. In any case, when he did go to Egypt, Riegl did not divest himself of his prejudices. He was unfortunately not as careful to avoid racial stereotyping as Marchand gives him credit for, and was perfectly capable of Orientalist remarks like the following from his lecture notes: “Even today every Oriental is an egoist. The Oriental essence is ineradicable.” Finally, the inclusion of Jewish studies in a study of Orientalist scholars brings up other issues when the visual arts are at stake. The myth of aniconism encompasses Islamic and Hebrew art and separates both from East Asian art. A further distinction between Jewish art and the other arts grouped among the “oriental” arts was enunciated perhaps best by Heinrich Frauberger (1845-1920), who wrote, concerning the Düsseldorf Museum of Applied Arts, that the collection was “rich in models for the Mohammedan and Buddhist cults, although neither Mohammedans nor Buddhists lived along the Rhein.” The German scholars of Jewish art, unlike German scholars of Buddhism, Islam, or Hindu texts, studied groups whose descendants lived along the Rhein, and perhaps even could count themselves among them. Some, such as the polymath scholar David Kaufmann, who included visual art in his portfolio, who studied Arabic as well as Hebrew medieval sources, and mixed genealogy with theory and philosophy, could have served as an illuminating example. Indeed, the example of Jewish art specifically brings up one of the dangers of Marchand’s dependence on individuals and their histories for explanations: one can end up evoking the very stereotypes that a study of Orientalism should avoid. Her generalization that “the realists adopt the Semites; the dreamers the Aryans” recalls the very Orientalist trope of uninspired Semites and idealist Aryans. Dreaming Jews, who certainly existed, did not tend to adopt the Aryans. The example suggests the limits of individual personality as an explanation. Generalizations and systems often blur or prove contradictory when examined with a close-up lens. When one draws back from the detail in Marchand’s book, and looks at it and the field it covers as a whole, does one see this larger field differently? With all its variations, is Orientalism still only a matter of “Othering” or is there something dialogic in a Bakhtinian sense, about the discourse? Surely if scholarship is a series of conversations, there is material enough in this book for many of them. If further, scholarship aims to widen and open the conversation to those beyond scholarly circles, then Marchand’s aim is very different from that of Said’s book, Orientalism. Indeed, his aim, to be relevant without being opportunistic or instrumental to empire, could be considered a modern installment of the discourse of Orientalism. In Said’s critique of Orientalism past, and his concentration on one well-documented distinction, he advances beyond the works Marchand cites that succeed in making cogent critiques of colonialism. Marchand’s work, which begins by assuming Said’s critique, ends by encompassing it. In addressing the ethics of Orientalism, Marchand works with one foot in the past and one in the present. She not only tries to understand why Orientalists followed the disparate paths that they followed, but she also struggles with what they should have done and, by extension, the ethics of present scholars of the Orient. In our present day of multiplying Arabic majors, her discussion has eerie echoes, which I hope will resound clearly throughout the mass of learned historical detail in this book.
Anonymous Functions An anonymous function—also referred to as a lambda —is a block of code that’s passed as an argument to a higher-order function. Wikipedia defines an anonymous function as, “a function definition that is not bound to an identifier.” For example, given a list like this: This is quite long winded. It follows the objected oriented approach of defining an anonymous function and instantiating it on the spot. Lambda Functions. In Scala, we can do all of the above like this (this is the exact equivalent of the code above): You want to use an anonymous function in Scala — also known as a function literal — so you can pass it into a method that takes a function, or to assign it to a variable. Scala Anonymous Function by Shekhar Sharma · May 14, 2020 In scala, when a function is written without a name is know as anonymous function, also called function literal – so you can pass it into a method that takes a function as an argument or assign it to a variable. Let’s understand it with an example below. In this example, this code is an anonymous function: _ * 2 This is a shorthand way of saying, “Multiply an element by 2.” Once you’re comfortable with Scala, this is a common way to write anonymous functions, but if you prefer, you can also write them using longer forms. Anonymous functions in Scala A function with no name is an anonymous function which is also known as function literal. This type of functions is used when the user wants to create an inline function. The second is for writing an anonymous function that does a match on its sole parameter. Your f2 is doing this, but not in any useful way. An example would be the anonymous function passed to collect , e.g. List(1, -2, 3) collect { case x if x > 0 => -x } . Scala provides a relatively lightweight syntax for defining anonymous functions. Anonymous functions in source code are called function literals and at run time, function literals are instantiated into objects called function values. 2) Passing an anonymous function as a function argument. As a second example of a function being passed as a variable to another function in Scala, that first example is modified so instead of passing a named function into the oncePerSecond function, we pass in an anonymous function directly from the main method. Here's that source code: In Scala, An anonymous function is also known as a function literal. A function which does not contain a name is known as an anonymous function. An anonymous function provides a lightweight function definition. It is useful when we want to create an inline function.
Scala Tutorial 16 - Function Currying in Scala - YouTube
Scala Function Types - Higher Order, Anonymous and Nested Functions, Closures. In scala, method may have multiple parameter lists. When a method is called with a fewer number of parameter lists, then this will yield a function taking the missing parameter lists as its ... Find code here - http://www.codebind.com/scala/function-currying-scala/Currying is the technique of transforming a function that takes multiple arguments in... In this Scala tutorial, I will talk about anonymous functions or a function literal or a lambda expression. Connect with me or follow me athttps://www.linkedin.com/in/durga0gadirajuhttps://www.facebook.com/itversityhttps://github.com/dgadirajuhttps://www.youtube.co... Scala is a functional language, in the sense that every function is a value. If functions are values, and values are objects, it follows that functions thems... When calling a function we indirectly invoke the apply method on the object that represents the function. We can use the anonymous class syntax for defining ... What is Anonymous Function? Understand in brief - JavaScript Tutorial - Part 31In this tutorial, we will learn what is an anonymous function. it is very impo...